package {{packageName}}.core.{{entity.module}}.filter;

import java.util.*;
{{#if entity.hasBigDecimal}}
import java.math.BigDecimal;
{{/if}}
import cn.ibizlab.util.filter.SearchContextBase;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;

import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
{{#entity.enableES}}
import org.elasticsearch.index.query.QueryBuilders;
{{/entity.enableES}}
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import {{packageName}}.core.{{entity.module}}.domain.{{entity.domainClassName}};

/**
 * 关系型数据实体[{{entity.codeName}}] 查询条件对象
 *
 * @author generator
 */
@Slf4j
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("{{entity.logicName}}查询条件对象")
public class {{entity.codeName}}SearchContext extends SearchContextBase {

    {{#each entity.fields as |field|}}
            {{#each field.allPSDEFSearchModes as |formitem|}}
    /**
     * {{field.logicName}}{{formitem.valueOP}}
     */
                    {{#if (or (eq formitem.valueOP "IN") (eq formitem.valueOP "ISNULL") (eq formitem.valueOP "ISNOTNULL"))}}
    @JsonProperty("{{lowerCase formitem.name}}")
    @JSONField(name = "{{lowerCase formitem.name}}")
                    {{else}}
    @JsonProperty("{{lowerCase formitem.name}}")
                        {{#timeType}}
    @JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
                        {{/timeType}}
    @JSONField(name = "{{lowerCase formitem.name}}"{{#timeType}} , format = "{{format}}"{{/timeType}})
                        {{#eq type.java "Long"}}
    @JsonSerialize(using = ToStringSerializer.class)            
                        {{/eq}}
                    {{/if}}
    @ApiModelProperty("{{field.logicName}}{{formitem.valueOP}}")
    private {{#if (or (eq formitem.valueOP "IN") (eq formitem.valueOP "ISNULL") (eq formitem.valueOP "ISNOTNULL"))}}String{{else}}{{field.javaType}}{{/if}} {{camelCase field.codeName}}{{formitem.valueOP}};

            {{/each}}
    {{/each}}

    @Override
    public void setQuery(String query) {
	this.query=query;
    }
}